package course.d1224;
import java.io.*;

/*
    转换流：
    InputStreamReader是字节流通向字符流的桥梁
    1.public InputStreamReader(InputStream in);
    使用指定的字符集创建一个InputStreamReader对象
    2.public InputStreamReader(InputStream in,String charset)
    使用指定的字符集创建一个InputStreamReader对象

    成员方法：
    1.public int read()throws IOException   读取单个字符
    2.public int read(char [] cs);   把读取到的字符存放到字符数组中

    OutputStreamWriter

 */
public class p5 {
    public static void main(String[] args) {
        try (InputStreamReader is = new InputStreamReader(new FileInputStream("a.txt"));
             OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream("b.txt"))) {
            int read;
            while ((read = is.read())!=-1){
                os.write(read);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
